function Ajax()
{
    var xmlhttp=false;
    try 
    {
        xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch(e)
    {
        try
        {                                    
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch(E) {
            xmlhttp=false;
        }
    }
    if (!xmlhttp && typeof XMLHttpRequest!="undefined") {
        xmlhttp=new XMLHttpRequest();
    }
    return xmlhttp;
}

function cargarLink(element_id)
{
    var element = document.getElementById(element_id);
    var url = "cargar_link.php";
    var idpagina = document.getElementById('pagina').value;
    var vAjax = Ajax();    
    vAjax.open("POST",url,true);
    vAjax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    vAjax.send("id="+idpagina);
    vAjax.onreadystatechange = function()
    {
        if(vAjax.readyState == 4)
        {
            element.innerHTML=vAjax.responseText;
        }
    }
}

function showDivArea() { 
    var id = document.getElementById('pagina').value;
    if(id == '3')
    {
        document.getElementById("div_cp_area").style.display="block"        
    }
    else
    {
        document.getElementById("div_cp_area").style.display="none"                    
    }
}

function trim (myString)
{
    return myString.replace(/^\s+/g,'').replace(/\s+$/g,'')
}